<!-- 日期范围设置组件 -->
<template>
    <div class="setting_config">
        <div class="label_title">
            <Icon type="ios-calendar-outline" size="18" color="#1055FF" />
            <div class="title">日期范围</div>
        </div>
        <div class="base_config">
            <div class="title">基本设置</div>
            <div class="config_item">
                <div class="label">字段名</div>
                <div class="input">
                    <Input v-model="dynamicForm.formList[dynamicForm.currentIndex].key" clearable />
                </div>
            </div>
            <div class="config_item">
                <div class="label">输入框提示语</div>
                <div class="input">
                    <Input v-model="dynamicForm.formList[dynamicForm.currentIndex].config.placeholder" clearable />
                </div>
            </div>
        </div>
        <div class="rules_config">
            <div class="title">验证设置</div>
            <div class="config_item">
                <div class="label">是否必填</div>
                <div class="input">
                    <Switch v-model="dynamicForm.formList[dynamicForm.currentIndex].required" />
                </div>
            </div>
            <div class="config_item" v-if="dynamicForm.formList[dynamicForm.currentIndex].required">
                <div class="label">为空时错误提示</div>
                <div class="input">
                    <Input v-model="dynamicForm.formList[dynamicForm.currentIndex].rules[0].message" clearable />
                </div>
            </div>
        </div>
    </div>
</template>

<script setup>
import { ref } from 'vue';
import {dynamicFormStore} from '@/store/dynamicForm';

const dynamicForm = dynamicFormStore();

</script>

<style scoped lang="scss">
.setting_config {
    .label_title {
        display: flex;
        align-items: center;
        padding-bottom: 10px;
        border-bottom: 1px solid #f1f1f1;
        .title {
            margin-left: 5px;
            font-weight: bold;
        }
    }
    .base_config {
        border-bottom: 1px solid #f1f1f1;
        padding-bottom: 10px;
        .title {
            padding: 10px 0;
            font-weight: bold;
        }
        .config_item {
            margin-bottom: 10px;
            .label {
                padding-bottom: 10px;
            }
        }
    }
    .rules_config {
        .title {
            padding: 10px 0;
            font-weight: bold;
        }
        .config_item {
            margin-bottom: 10px;
            .label {
                padding-bottom: 10px;
            }
        }
    }
}
</style>